<template>
  <div>
    <Header />
    <Right />
    <div class="zoon"></div>
    <div class="crumb">
      <span>首页</span>
      <span>房源详情</span>
      <span>法拍经理详情</span>
    </div>
    <!-- 法拍经理 -->
    <div class="manager">
      <img :src="manager.headUrl" alt class="head" />
      <div class="header_conter">
        <!-- 经理名字 -->
        <p class="name">
          <span>{{ manager.name }}</span>
          <span class="name_post">法拍经理</span>
        </p>
        <!-- 从业年数 -->
        <p>
          <span class="year">
            从业年数
            <span class="year_num">{{ manager.workYear }}年</span>
          </span>
          <span class="year">
            勘探楼盘
            <span class="year_num">{{ manager.explorationBuilding }}个</span>
          </span>
        </p>
        <p>
          <span class="year">
            服务人数
            <span class="year_num">{{ manager.customerNum }}个</span>
          </span>
          <span class="year">
            好评率
            <span class="year_num">{{ manager.evaluate }}%</span>
          </span>
        </p>
        <p>
          <span class="year">
            个人成绩
            <span class="year_num">{{ manager.performance }}</span>
          </span>
        </p>
        <p>
          <span class="year">
            主营板块
            <span class="year_num">{{ manager.performance }}</span>
          </span>
        </p>
        <p>
          <span class="year">
            能力介绍
            <span class="year_num">{{ manager.info }}</span>
          </span>
        </p>
      </div>
      <div class="consult">
        <div class="color_orgin consult_text" @click="On53()">
          <p class="consult_img orgin_img">
            <img src="../../assets/img/phone.png" alt />
          </p>
          <p>在线咨询</p>
        </div>
        <el-tooltip class="item" effect="dark" :content="manager.telephone" placement="top-start">
          <div class="consult_text color">
            <p class="color_img consult_img">
              <img src="../../assets/img/message1.png" alt />
            </p>
            <p>电话咨询</p>
          </div>
        </el-tooltip>
      </div>
    </div>
    <!-- 房屋 -->
    <div class="houseList">
      <div class="house_fill">
        <span>主要负责房源</span>
        <p class="line"></p>
      </div>
      <div v-if="formdata">
        <div class="house_list">
          <div class="list" v-for="(item, index) in formdata" :key="index">
            <div class="price_img">
              <img
                :src="item.img[0]"
                alt
                class="home_img"
                v-if="item.img"
                @click="onDetails(item.id)"
              />
              <img src="../../assets/img/demo.png" alt v-else class="home_img" />
              <p
                class="soon"
                :class="[
                  item.sellStage === '即将拍卖' ? 'soonGreen' : 'soonRed'
                ]"
              >{{ item.sellStage }}</p>
              <img
                :src="[
                  item.ynFollow != 1
                    ? require(`@/assets/img/wdgzb_2.png`)
                    : require(`@/assets/img/ygz_2.png`)
                ]"
                alt
                @click="Onfollow(item, index)"
                class="heart"
              />
              <p class="home" v-if="item.houseStageName">{{ item.houseStageName }}</p>
              <p class="time">开拍时间：{{ item.startSaleTimeStr }}</p>
            </div>
            <div @click="onDetails(item.id)">
              <p class="list_title">{{ item.title }}</p>
              <p>
                <span class="hall">{{ item.bedRoomCount }}室{{ item.visitorRoomCount }}厅</span>
                <span class="centare">{{ item.coveredArea }}㎡</span>
                <span class="orientation" v-if="item.directionName">朝{{ item.directionName }}</span>
              </p>
              <p class="price">市场价：{{ item.marketSalePrice }}万</p>
              <div class="startPrice">
                <p class="start">
                  起拍价：
                  <span>{{ item.startSalePrice }}万</span>
                </p>
                <img src="../../assets/img/zxzx.png" alt @click="On53" />
              </div>
            </div>
          </div>
        </div>
        <div class="block">
          <el-pagination
            layout="prev, pager, next"
            :total="total"
            :page-size="6"
            v-if="formdata"
            @current-change="handleCurrentChange"
          ></el-pagination>
        </div>
      </div>
      <div class="houseList" v-else>暂无数据</div>
    </div>

    <Footer />
  </div>
</template>
<script>
import Header from "@/components/pc_file/header.vue";
import Footer from "@/components/pc_file/footer.vue";
import Right from "@/components/pc_file/right.vue";
export default {
  data() {
    return {
      id: "",
      manager: {},
      total: 0, //总行数
      pageSize: 6, //每页几行
      List: [],
      page: 1, //起始页
      formdata: []
    };
  },
  mounted() {
    this.id = this.$route.query.id;
    this.OnfpDetail();
  },
  methods: {
    pageChange(page) {
      this.startpage = page;
      this.getTaskList();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.OnfpList();
    },
    On53() {
      window.open(
        "https://tb.53kf.com/code/client/9a12bb00652ff2c013fe004ae3947f845/1",
        "_blank"
      );
      this.stopBubbling(event);
    },
    stopBubbling(e) {
      e = window.event || e;
      if (e.stopPropagation) {
        e.stopPropagation(); //阻止事件 冒泡传播
      } else {
        e.cancelBubble = true; //ie兼容
      }
    },
    OnfpDetail() {
      this.instance
        .fpManagerDetail({
          id: this.id
        })
        .then(res => {
          if (res.data.code == "0") {
            this.manager = res.data.data;
            this.total = this.manager.reponsibleHouseList.length;
            this.OnfpList();
          }
        });
    },
    OnfpList() {
      this.formdata = [];
      const start = (this.page - 1) * 6;
      const end = this.page * 6 + 1;
      this.manager.reponsibleHouseList.forEach((item, index) => {
        console.log(start, end);
        if (start < index && index < end) {
          this.formdata.push(item);
        }
      });
    }
  },
  components: {
    Header,
    Footer,
    Right
  }
};
</script>
<style lang="less" scoped>
p {
  font-size: 14px;
}
.zoon {
  height: 80px;
}
.crumb {
  width: 1200px;
  margin: 0 auto;
  padding: 30px 0px;
  color: #999999;
  font-size: 14px;
}
.manager {
  cursor: pointer;
  width: 1200px;
  margin: 0 auto;
  background: #fbfbfb;
  padding: 30px;
  display: flex;
  position: relative;
  .head {
    width: 124px;
    height: 185px;
    border-radius: 7px;
  }
  .header_conter {
    margin-left: 30px;
    p {
      margin-bottom: 15px;
    }
    .name {
      font-size: 28px;
      margin-bottom: 30px;
      .name_post {
        width: 60px;
        height: 17px;
        background: #ffd8ca;
        border: 1px solid #f58057;
        border-radius: 2px;
        color: #f58057;
        font-size: 12px;
        line-height: 17px;
        text-align: center;
        margin-left: 20px;
      }
    }

    .year {
      font-size: 14px;
      margin-right: 60px;
      .year_num {
        font-size: 12px;
        color: #888888;
        margin-left: 5px;
      }
    }
  }

  .consult {
    border-radius: 2px;
    position: absolute;
    right: 50px;
    bottom: 30px;
    .consult_text {
      display: flex;
      height: 21px;
      margin-bottom: 10px;
      background: #fff;
      text-align: center;
      font-size: 12px;

      .orgin_img {
        background: #f58057;
      }
      .color_img {
        background: #55a3ff;
      }

      .consult_img {
        width: 21px;
        height: 21px;
      }
    }
    .color_orgin {
      border: 1px solid #f58057;
    }
    .color {
      border: 1px solid #55a3ff;
    }
  }
}
.houseList {
  width: 1200px;
  margin: 50px auto;
  overflow: hidden;
  .house_fill {
    border-bottom: 1px solid #f58057;
    span {
      padding: 10px;
    }
    .line {
      width: 24px;
      height: 4px;
      margin-top: 15px;
      margin-left: 30px;
      background: #f58057;
      border-radius: 2px;
    }
  }
  .house_list {
    overflow: hidden;
    .list {
      cursor: pointer;
      float: left;
      width: 31.33%;
      margin-right: 20px;
      margin-top: 10px;
      .price_img {
        position: relative;
        margin-bottom: 25px;

        .home_img {
          width: 380px;
          height: 214px;
          border-radius: 6px;
          margin-bottom: 35px;
        }
        .soon {
          position: absolute;
          top: 0;
          width: 89px;
          height: 31px;
          border-radius: 6px 0px 6px 0px;
          line-height: 31px;
          text-align: center;
          font-size: 14px;
          color: #fff;
        }
        .soonGreen {
          background: linear-gradient(0deg, #19aa6b, #3cd6a2, #3cd8a4);
        }
        .soonRed {
          background: #d91615;
        }
        .heart {
          position: absolute;
          right: 0;
          top: 0;
        }
        .home {
          position: absolute;
          top: 180px;
          right: 20px;
          width: 46px;
          height: 20px;
          background: #f5643e;
          border-radius: 2px;
          text-align: center;
          line-height: 20px;
          color: #fff;
          font-size: 12px;
        }
        .time {
          position: absolute;
          top: 200px;
          left: 20%;
          width: 226px;
          height: 33px;
          background: #ffffff;
          box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.05);
          border-radius: 17px;
          line-height: 33px;
          text-align: center;
          font-size: 13px;
          color: #7d7b7b;
        }
      }
      .list_title {
        font-size: 16px;
        font-weight: bold;
        color: #333333;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-bottom: 15px;
      }
      .hall {
        padding: 3px;
        margin-right: 5px;
        font-size: 12px;
        color: #ff6565;
        background: #fff3f3;
      }
      .centare {
        padding: 3px;
        margin-right: 5px;
        font-size: 12px;
        color: #ff9555;
        background: #fff5df;
      }
      .orientation {
        padding: 3px;
        margin-right: 5px;
        font-size: 12px;
        color: #17d1bb;
        background: #e7f9f7;
      }
      .price {
        margin: 13px 0px;
        color: #656967;
      }
      .price_img {
        width: 380px;
        height: 254px;
      }
      .startPrice {
        overflow: hidden;
        .start {
          float: left;
          span {
            color: #f4643e;
          }
        }
        img {
          float: right;
          width: 20px;
          height: 20px;
        }
      }
    }
  }
  .block {
    text-align: center;
    margin: 20px 0;
  }
}
</style>
